﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:Primitives="clr-namespace:Microsoft.Windows.Controls.Ribbon.Primitives;assembly=RibbonControlsLibrary"
		xmlns:Ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
		xmlns:ext="clr-namespace:Microsoft.Windows.Shell;assembly=Microsoft.Windows.Shell">
	<Style TargetType="Ribbon:RibbonTab">
		<Setter Property="ext:WindowChrome.IsHitTestVisibleInChrome" Value="True" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="Ribbon:RibbonTab">
					<Border x:Name="MainGrid" ClipToBounds="True">
						<Border.Visibility>
							<TemplateBinding Property="IsSelected">
								<TemplateBinding.Converter>
									<BooleanToVisibilityConverter />
								</TemplateBinding.Converter>
							</TemplateBinding>
						</Border.Visibility>
						<ScrollViewer x:Name="ScrollViewer">
							<ScrollViewer.Style>
								<Style TargetType="{x:Type ScrollViewer}">
									<Setter Property="Focusable" Value="False" />
									<Setter Property="VerticalScrollBarVisibility" Value="Disabled" />
									<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
									<Setter Property="CanContentScroll" Value="True" />
									<Setter Property="Template">
										<Setter.Value>
											<ControlTemplate TargetType="{x:Type ScrollViewer}">
												<Grid x:Name="Grid" Background="{TemplateBinding Background}">
													<Grid.ColumnDefinitions>
														<ColumnDefinition Width="Auto" />
														<ColumnDefinition Width="*" />
														<ColumnDefinition Width="Auto" />
													</Grid.ColumnDefinitions>
													<ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
															CanContentScroll="{TemplateBinding CanContentScroll}"
															CanHorizontallyScroll="False" Grid.ColumnSpan="3"
															CanVerticallyScroll="False"
															ContentTemplate="{TemplateBinding ContentTemplate}"
															Content="{TemplateBinding Content}"
															Margin="{TemplateBinding Padding}" />
													<RepeatButton Grid.Column="0"
															CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
															Command="ScrollBar.LineLeftCommand" Focusable="False"
															HorizontalContentAlignment="Left">
														<RepeatButton.Style>
															<Style TargetType="{x:Type RepeatButton}">
																<Setter Property="OverridesDefaultStyle" Value="True" />
																<Setter Property="Focusable" Value="False" />
																<Setter Property="Width" Value="14" />
																<Setter Property="Background"
																		Value="{Binding (Ribbon:RibbonControlService.Ribbon).Background, RelativeSource={RelativeSource Self}}" />
																<Setter Property="BorderBrush"
																		Value="{Binding (Ribbon:RibbonControlService.Ribbon).BorderBrush, RelativeSource={RelativeSource Self}}" />
																<Setter Property="Template">
																	<Setter.Value>
																		<ControlTemplate
																				TargetType="{x:Type RepeatButton}">
																			<Border x:Name="OuterBorder"
																					BorderBrush="{TemplateBinding BorderBrush}"
																					BorderThickness="1"
																					Background="{TemplateBinding Background}">
																				<!--<Border x:Name="InnerBorder"
																						Background="#80FFFFFF">-->
																				<Border x:Name="InnerBorder"
																						Background="Transparent">
																					<Path x:Name="GlyphPath"
																							Data="M4,0L0,3.5 4,7"
																							Fill="Gray"
																							HorizontalAlignment="Center"
																							VerticalAlignment="Center" />
																				</Border>
																			</Border>
																			<ControlTemplate.Triggers>
																				<Trigger
																						Property="HorizontalContentAlignment"
																						Value="Right">
																					<Setter Property="Data"
																							TargetName="GlyphPath"
																							Value="M0,0L4,3.5 0,7" />
																				</Trigger>
																			</ControlTemplate.Triggers>
																		</ControlTemplate>
																	</Setter.Value>
																</Setter>
															</Style>
														</RepeatButton.Style>
														<RepeatButton.Visibility>
															<MultiBinding ConverterParameter="0"
																	FallbackValue="Visibility.Collapsed"
																	UpdateSourceTrigger="Default">
																<MultiBinding.Converter>
																	<Primitives:RibbonScrollButtonVisibilityConverter />
																</MultiBinding.Converter>
																<Binding Path="ComputedHorizontalScrollBarVisibility"
																		RelativeSource="{RelativeSource TemplatedParent}" />
																<Binding Path="HorizontalOffset"
																		RelativeSource="{RelativeSource TemplatedParent}" />
																<Binding Path="ExtentWidth"
																		RelativeSource="{RelativeSource TemplatedParent}" />
																<Binding Path="ViewportWidth"
																		RelativeSource="{RelativeSource TemplatedParent}" />
															</MultiBinding>
														</RepeatButton.Visibility>
													</RepeatButton>
													<RepeatButton Grid.Column="2"
															CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
															Command="ScrollBar.LineRightCommand" Focusable="False"
															HorizontalContentAlignment="Right">
														<RepeatButton.Style>
															<Style TargetType="{x:Type RepeatButton}">
																<Setter Property="OverridesDefaultStyle" Value="True" />
																<Setter Property="Focusable" Value="False" />
																<Setter Property="Width" Value="14" />
																<Setter Property="Background"
																		Value="{Binding (Ribbon:RibbonControlService.Ribbon).Background, RelativeSource={RelativeSource Self}}" />
																<Setter Property="BorderBrush"
																		Value="{Binding (Ribbon:RibbonControlService.Ribbon).BorderBrush, RelativeSource={RelativeSource Self}}" />
																<Setter Property="Template">
																	<Setter.Value>
																		<ControlTemplate
																				TargetType="{x:Type RepeatButton}">
																			<Border x:Name="OuterBorder"
																					BorderBrush="{TemplateBinding BorderBrush}"
																					BorderThickness="1"
																					Background="{TemplateBinding Background}">
																				<!--<Border x:Name="InnerBorder"
																						Background="#80FFFFFF">-->
																				<Border x:Name="InnerBorder"
																						Background="Transparent">
																					<Path x:Name="GlyphPath"
																							Data="M4,0L0,3.5 4,7"
																							Fill="Gray"
																							HorizontalAlignment="Center"
																							VerticalAlignment="Center" />
																				</Border>
																			</Border>
																			<ControlTemplate.Triggers>
																				<Trigger
																						Property="HorizontalContentAlignment"
																						Value="Right">
																					<Setter Property="Data"
																							TargetName="GlyphPath"
																							Value="M0,0L4,3.5 0,7" />
																				</Trigger>
																			</ControlTemplate.Triggers>
																		</ControlTemplate>
																	</Setter.Value>
																</Setter>
															</Style>
														</RepeatButton.Style>
														<RepeatButton.Visibility>
															<MultiBinding ConverterParameter="100"
																	FallbackValue="Visibility.Collapsed"
																	UpdateSourceTrigger="Default">
																<MultiBinding.Converter>
																	<Primitives:RibbonScrollButtonVisibilityConverter />
																</MultiBinding.Converter>
																<Binding Path="ComputedHorizontalScrollBarVisibility"
																		RelativeSource="{RelativeSource TemplatedParent}" />
																<Binding Path="HorizontalOffset"
																		RelativeSource="{RelativeSource TemplatedParent}" />
																<Binding Path="ExtentWidth"
																		RelativeSource="{RelativeSource TemplatedParent}" />
																<Binding Path="ViewportWidth"
																		RelativeSource="{RelativeSource TemplatedParent}" />
															</MultiBinding>
														</RepeatButton.Visibility>
													</RepeatButton>
												</Grid>
											</ControlTemplate>
										</Setter.Value>
									</Setter>
								</Style>
							</ScrollViewer.Style>
							<Grid RenderOptions.ClearTypeHint="Enabled">
								<Canvas x:Name="BackgroundCanvas" HorizontalAlignment="Left" Height="0" Margin="0,1,0,0"
										VerticalAlignment="Top" Width="0">
									<Rectangle x:Name="OpaqueRect"
											Fill="{Binding (Ribbon:RibbonControlService.Ribbon).Background, RelativeSource={RelativeSource Self}}"
											Height="{Binding ActualHeight, ElementName=ScrollViewer}"
											Width="{Binding ActualWidth, ElementName=ScrollViewer}" />
									<Rectangle x:Name="OverlayRect"
											Height="{Binding ActualHeight, ElementName=ScrollViewer}"
											Width="{Binding ActualWidth, ElementName=ScrollViewer}">
										<!--<Rectangle.Fill>
											<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
												<GradientStop Color="#EEFFFFFF" Offset="0" />
												<GradientStop Color="#BBFFFFFF" Offset="0.1" />
												<GradientStop Color="#05FFFFFF" Offset="0.5" />
												<GradientStop Color="#20FFFFFF" Offset="1" />
											</LinearGradientBrush>
										</Rectangle.Fill>-->
									</Rectangle>
									<!--<Rectangle x:Name="InnerOverlayRect" Fill="#60FFFFFF"
											Height="{Binding ActualHeight, ElementName=ScrollViewer}"
											Width="{Binding ActualWidth, ElementName=ScrollViewer}" />-->
									<Rectangle x:Name="InnerOverlayRect" Fill="Transparent"
											Height="{Binding ActualHeight, ElementName=ScrollViewer}"
											Width="{Binding ActualWidth, ElementName=ScrollViewer}" />
								</Canvas>
								<ItemsPresenter x:Name="ItemsPresenter" />
							</Grid>
						</ScrollViewer>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="CanContentScroll" SourceName="ScrollViewer" Value="False">
							<Setter Property="Canvas.Top" TargetName="OpaqueRect"
									Value="{Binding VerticalOffset, ElementName=ScrollViewer}" />
							<Setter Property="Canvas.Left" TargetName="OpaqueRect"
									Value="{Binding HorizontalOffset, ElementName=ScrollViewer}" />
							<Setter Property="Canvas.Top" TargetName="OverlayRect"
									Value="{Binding VerticalOffset, ElementName=ScrollViewer}" />
							<Setter Property="Canvas.Left" TargetName="OverlayRect"
									Value="{Binding HorizontalOffset, ElementName=ScrollViewer}" />
							<Setter Property="Canvas.Top" TargetName="InnerOverlayRect"
									Value="{Binding VerticalOffset, ElementName=ScrollViewer}" />
							<Setter Property="Canvas.Left" TargetName="InnerOverlayRect"
									Value="{Binding HorizontalOffset, ElementName=ScrollViewer}" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>